package com.ifinc.common.web;

import com.ifinc.common.service.DBJdbcService;
import com.ifinc.common.service.GlobalService;
import org.apache.log4j.Logger;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: luotao
 * Date: 13-10-28
 * Time: 下午8:51
 * To change this template use File | Settings | File Templates.
 */
public abstract class BaseRequest {
    protected Logger log = Logger.getLogger(this.getClass());

    protected Map<String,Object> param;

    protected Map<String,String> header;

    public void setParam(Map<String, Object> param) {
        this.param = param;
    }

    public void setHeader(Map<String, String> header) {
        this.header = header;
    }

    protected Map result = new LinkedHashMap();

    protected GlobalService globalService;

    protected DBJdbcService dbService;

    public abstract void verify();

    public abstract void doAction();

    public void save(String sql,Object ... values){
        dbService.update(sql,values);
    }

    public void log_debug(String mesg){
        globalService.getLogger().debug(mesg);
    }

    public void log_info(String mesg){
        globalService.getLogger().info(mesg);
    }

    public void log_error(String mesg){
        globalService.getLogger().error(mesg);
    }

    public void log_warn(String mesg){
        globalService.getLogger().warn(mesg);
    }
}
